Skip to content

fix(projector): validate GitHub API response shapes in github.ts (#6954) - #6955

Merged
dezren39 merged 1 commit into
mainfrom
creator-b/6954-projector-github-shape
Nov 7, 2026
Merged

dezren39 merged 1 commit into
mainfrom
creator-b/6954-projector-github-shape

Conversation

@dezren39

@dezren39 dezren39 commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Fixes #6954

Validates the three shape-trusted GitHub API response sites in pm-stack/projector/src/github.ts:

  • listResource: a non-array 200 page now throws github_api_unexpected_shape: <url> returned <shape>, expected an array instead of a raw spread TypeError (null/object/number) or silently spreading a string page into per-character rows.
  • discoverInstallationId: a wrong-shape/null 200 body returns undefined like the non-200 case, so apiTokenFor proceeds to the configured installation id and the plain-token fallback.
  • apiTokenFor: an access-token reply is accepted only with a non-empty string token; anything else throws installation_token_failed_shape: access_tokens response carried no string token instead of returning {kind:"app", token: undefined} as success or throwing a raw property-access TypeError on null.

Verification (laptop, worktree on origin/main 56b6a47):

  • Probe ~/git/fleet/probe-projector-github (real module, stubbed fetch): all defect cases now fail in the module vocabulary or fall back; controls ([{n:1}] page, {token:"good-token"}) unchanged.
  • bun test test/github.test.ts: 17/17 pass (14 shipped + 3 new shape tests); the 3 new tests fail on pre-fix code.
  • Full projector suite: the 10 pre-existing failures are Cannot find module '@libsql/client' (deps not installed), byte-identical on unmodified main; github.test.ts does not import libsql.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 7, 2026 21:04
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T21:06:01.630252Z 283304e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39
dezren39 merged commit 4adffb6 into main Nov 7, 2026
1 of 3 checks passed
@dezren39
dezren39 deleted the creator-b/6954-projector-github-shape branch November 7, 2026 21:05
@coderabbitai

coderabbitai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant